import http from "@/api";
import {Device, DeviceInformation, Model, MonitioringProject, MysqlBack, ResPage} from "@/api/interface";

// 获取设备列表
export const getDeviceList = () => {
  return http.get(`/server-api/device/deviceALl`);
};

// 获取特征列表,1是zpw，2是25hz
export const getFeatureList = (typeId: number) => {
  return http.get(`/server-api/data_analog/dataAnalogALl/${typeId}`);
};


export const getMonitoringProjectList = (params) => {
  return http.get<ResPage<MonitioringProject.ResMonitioringProjectList>>(`/server-api/monitoring_project/page`,params);
};
export const deleteMonitoringProjectList = (params) => {
  return http.delete(`/server-api/monitoring_project/`+params.mid);
};
export const deleteBatchMonitoringProjectList = (params) => {
  return http.post(`/server-api/monitoring_project/del/batch`,params);
};
export const saveorupdateMonitoringProjectList = (params) => {
  return http.post(`/server-api/monitoring_project`,params);
};


export const getDeviceAllList = (params) => {
  return http.get<ResPage<Device.ResDeviceList>>(`/server-api/device/device/page`,params);
};

export const saveorupdateDeviceList = (params) => {
  console.log('params',params)
  return http.post(`/server-api/device`,params);
};
export const deleteDevice = (params) => {
  return http.delete(`/server-api/device/`+params.did);
};
export const deleteBatchDevice = (params) => {
  return http.post(`/server-api/device/del/batch`,params);
};




export const getDeviceInformationList = (params) => {
  return http.get<ResPage<DeviceInformation.ResDeviceInformationList>>(`/server-api/deviceinformation/page`,params);
};
export const saveorupdateDeviceInformationList = (params) => {
  return http.post(`/server-api/deviceinformation`,params);
};
export const deleteDeviceInformation = (params) => {
  return http.delete(`/server-api/deviceinformation/`+params.id);
};

export const deleteBatchDeviceInformation = (params) => {
  return http.post(`/server-api/deviceinformation/del/batch`,params);
};


export const getMysqlBack = (params) => {
  return http.get<ResPage<MysqlBack.ResMysqlBackList>>(`/server-api/mysqlBack/getList`,params);
};


export const getSendTime = (sendTime) => {
  return http.get(`/server-api/data_analog/startTask/${sendTime}`);
};
